home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEMP
/
GNU
/
bison
/
Precedencg
< prev
next >
Wrap
Text File
|
1995-06-28
|
767b
|
33 lines
Precedence Examples
Previous: <Using Precedence=>UsingPrece> * Next: <How Precedence=>HowPrecede> * Up: <Precedence=>Precedencf>
#Wrap on
{fH4}Precedence Examples{f}
In our example, we would want the following declarations:
#Wrap off
#fCode
%left '<'
%left '-'
%left '\*'
#f
#Wrap on
In a more complete example, which supports other operators as well, we
would declare them in groups of equal precedence. For example, {fCode}'+'{f} is
declared with {fCode}'-'{f}:
#Wrap off
#fCode
%left '<' '>' '=' NE LE GE
%left '+' '-'
%left '\*' '\/'
#f
#Wrap on
(Here {fCode}NE{f} and so on stand for the operators for ``not equal''
and so on. We assume that these tokens are more than one character long
and therefore are represented by names, not character literals.)